import request from '@/utils/request'

// 获取用户列表
export function getUserListService(params) {
  return request({
    url: '/user/list',
    method: 'get',
    params
  })
}

// 添加用户
export function addUserService(data) {
  return request({
    url: '/api/admin/user/add',
    method: 'post',
    data
  })
}

// 更新用户
export function updateUserService(data) {
  return request({
    url: '/api/admin/user/update',
    method: 'put',
    data
  })
}

// 删除用户
export function deleteUserService(userId) {
  return request({
    url: `/api/admin/user/delete/${userId}`,
    method: 'delete'
  })
}

// 获取用户详情
export function getUserDetailService(userId) {
  return request({
    url: `/api/admin/user/detail/${userId}`,
    method: 'get'
  })
}

// 手机号登录
export function loginByPhoneService(data) {
  return request({
    url: '/login/phone',
    method: 'post',
    data
  })
}

// 获取用户信息
export function getUserInfoService() {
  return request({
    url: '/user/userInfo',
    method: 'get'
  })
}

// 更新用户信息
export function updateUserInfoService(data) {
  return request({
    url: '/user',
    method: 'put',
    data
  })
}

// 注册用户
export function registerUserService(data) {
  return request({
    url: '/user/register',
    method: 'post',
    data
  })
} 